﻿//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;

//using System.Management.Automation;

//using ESF.MUP.BasePlatform;
//using ESF.MUP.BasePlatform.Services;
//using ESF.MUP.BasePlatform.Domain.Model;
//using ESF.MUP.BasePlatform.ApplicationServices.Interfaces;
////using ESF.MUP.BasePlatform.DbService;
////using ESF.MUP.BasePlatform.DbService.MSSQL;

//using Microsoft.Practices.Unity;

//namespace ESF.MUP.Powershell
//{
//    [Cmdlet(VerbsLifecycle.Register, "ApplicationInstance")]
//    public class RegisterApplicationInstance : BaseCmdlet
//    {

//        [Parameter(Mandatory=true)]
//        public Application Application { get; set; }


//        [Parameter(Mandatory = true)]
//        public ESF.MUP.BasePlatform.Domain.Model.Environment Environment { get; set; }


//        protected override void ProcessRecord()
//        {
//            IApplicationService appSvc = MiddlewareManagementService.Current.GetApplicationService();

//            var query = from a in this.Application.Instances
//                        where a.EnvironmentId == this.Environment.Id
//                        select a;

//            ApplicationInstance appInstance = query.SingleOrDefault();

//            if (appInstance == null)
//            {
//                appInstance = new ApplicationInstance()
//                {
//                    Application = this.Application,
//                    Environment = this.Environment
//                };
//                this.Application.Instances.Add(appInstance);
//                appInstance = this.Application.Instances[this.Application.Instances.Count - 1];
//            }

//            this.WriteObject(appInstance);
//        }
//    }
//}
